package com.reggie.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.reggie.common.result.PageResult;
import com.reggie.mapper.SjMapper;
import com.reggie.pojo.dto.SjPageQueryDTO;
import com.reggie.pojo.entity.Sj;
import com.reggie.pojo.vo.SjVo;
import com.reggie.service.SjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SjServiceImpl implements SjService {

    @Autowired
    private SjMapper sjMapper;


    //分页查询
    @Override
    public PageResult page(SjPageQueryDTO sjPageQueryDTO) {
        PageHelper.startPage(sjPageQueryDTO.getPage(), sjPageQueryDTO.getPageSize());
        Page<Sj> page = sjMapper.page(sjPageQueryDTO);
        long total =page.getTotal();
        List<Sj> result =page.getResult();
        PageResult pageResult=new PageResult(total,result);
        return pageResult;
    }


}
